package org.meandslava.calc.arithmetic;

import java.util.LinkedList;

public class Unary extends Arithmetic {
	public Unary(String tag){
		super(tag);
		//myCategoryTag = CATEGORY_UNARY;
	}
	
	@Override
	public double calc(double previousValue, LinkedList<Term> queue) {
		if(tag.equals("sin")){
			return Math.sin(previousValue);
		}else if(tag.equals("cos")){
			return Math.cos(previousValue);
		}else if(tag.equals("tg")){
			return Math.tan(previousValue);
		}else if(tag.equals("ctg")){
			return 1/Math.tan(previousValue);
		}else if(tag.equals("exp")){
			return Math.exp(previousValue);
		}else if(tag.equals("abs")){
			return Math.abs(previousValue);
		}
		return previousValue;
	}

	@Override
	public boolean process(String categoryTag, String action) {
		return false;
	}

}
